<?php 

namespace Home\Controller;
use Think\Controller;
/**
* 发现更多nuke信息模块
*/
class FindController extends Controller
{


	public function index(){
	//发现区域主页
		// $sql = "SELECT `city`,`province`,`score`,`index` from `user` where `id` = '{$_SESSION['id']}'";

		// $modle = M('user');

		// $result = $modle -> query($sql);

		// $this->assign('result',$result);

		$modle = M();
		$sql = "select count(*) cn from question";
		$count = current($modle->query($sql))['cn'];

		$Page  = new \Think\Page($count,3);

		$show  = $Page->show();

		// var_dump($Page->firstRow,$Page->listRows);


		// echo $show;exit;


		
		// 最新问题列表
		$sql = "select t1.*,t2.username,t2.head_img,t3.cname from question t1 left join user t2 on t1.uid=t2.id left join category t3 on t1.category_id=t3.id order by t1.time desc limit {$Page->firstRow},{$Page->listRows}";
		$newList = $modle->query($sql);
		// var_dump($newList);exit;
		$this->assign('show',$show);
		$this->assign('newList',$newList);
		$this->display();
		
	}






}
?>